As a conventional technique associated with pattern inspection for detecting a defect by comparing successively input images to be inspected with a reference image as an example of similarity comparison, there are known Japanese Patent Laid-Open Nos. 5-232038 and 2001-22935.
In Japanese Patent Laid-Open No. 5-232038, a difference image signal between an image signal of N×M pixels which is acquired from an image signal of an image to be inspected, and an image signal of N×M pixels which is acquired from an image signal of a reference image stored in a memory is calculated while the image is shifted pixel by pixel up to a maximum pixel count M designated in advance in the horizontal and vertical directions. The absolute values of difference image signals are added by an addition circuit, and a minimum value is detected by a minimum value detection circuit, decreasing a difference at a pattern edge and detecting only a defect.
In Japanese Patent Laid-Open No. 2001-22935, alignment is executed at a plurality of stages (a stage for a region having a large number of pixels and a stage for a region having a small number of pixels) on the basis of electron beam image signals successively detected from an object to be inspected in which various fine patterns coexist, thereby reducing alignment errors at high precision of subpixel order. The frequency of erroneous detection of a normal fine pattern can be reduced, and a small defect generated on a fine pattern can be accurately inspected without missing such a defect.
However, according to Japanese Patent Laid-Open No. 5-232038, when the shift range is wide, the calculation cost greatly rises. The difference between image signals can be recognized at only a precision of an N×M block.
In Japanese Patent Laid-Open No. 2001-22935, position shifting matching is executed at a low resolution, and the position shifting range at the next resolution is limited in accordance with the degree and continuity of matching, realizing both high speed and high precision.
In initial matching targeted to a divided block of many pixels, matching is done while shifting the position of the divided block in steps of unitary pixels. When a block of a wide region has several ten to several hundred pixels, comparison processing in the square order must be performed at this stage in performing matching tolerant of a position shift almost close to the block size. Considering the polarity of the matching distance by position shifting, position shifting is done in a more restricted range in subsequent detail matching, and then detail matching is executed to detect a difference. In this case, the precision is high, but the calculation cost rises, and high-speed search cannot be expected.